AC_INIT
AC_CONFIG_SRCDIR([mod_svn.c])
AC_CONFIG_HEADER(config.h)
AC_PROG_CC
AC_PROG_INSTALL
AC_PREFIX_DEFAULT(/usr/local)

WFLAGS=" -W -Wall -Werror -Wmissing-declarations -Wextra"
WFLAGS="$WFLAGS -Waggregate-return -Wcast-align -Wcast-qual"
WFLAGS="$WFLAGS -Wmissing-declarations -Wmissing-prototypes"
WFLAGS="$WFLAGS -Wno-conversion -Wpointer-arith -Wshadow"
WFLAGS="$WFLAGS -Wuninitialized -Wcast-align -Wcast-qual"
WFLAGS="$WFLAGS -Wformat=2 -Wformat-nonliteral -Wwrite-strings"

# Process flag arguments early, so they are available for tests later
AC_ARG_ENABLE(gcc-warnings,
   [  --enable-gcc-warnings   Enable verbose warnings (only for gcc)],
   [ if test "x$enableval" = "xyes" ; then CFLAGS="$CFLAGS $WFLAGS"; fi ]
)
AC_ARG_WITH(cflags,
   [  --with-cflags           Specify additional compiler flags],
   [ if test "x$withval" != "xno" ; then CFLAGS="$CFLAGS $withval"; fi ]
)
AC_ARG_WITH(cppflags,
   [  --with-cppflags         Specify additional preprocessor flags] ,
   [ if test "x$withval" != "xno"; then CPPFLAGS="$CPPFLAGS $withval"; fi ]
)
AC_ARG_WITH(ldflags,
   [  --with-ldflags          Specify additional linker flags],
   [ if test "x$withval" != "xno" ; then LDFLAGS="$LDFLAGS $withval"; fi ]
)
AC_ARG_WITH(libs,
   [  --with-libs             Specify additional libraries to link with],
   [ if test "x$withval" != "xno" ; then LIBS="$LIBS $withval"; fi ]
)

AC_CHECK_HEADER(tcl.h, [], ["Do not know where tcl.h"])
AC_CHECK_HEADERS([subversion-1/svn_client.h])
AC_CHECK_HEADERS([subversion-1/svn_types.h])
AC_CHECK_TYPES([u_int64_t, int64_t, uint64_t, u_int32_t, int32_t, uint32_t])
AC_CHECK_TYPES([u_int16_t, int16_t, uint16_t, u_int8_t, int8_t, uint8_t])
AC_CHECK_SIZEOF(char, 1)
AC_CHECK_SIZEOF(short int, 2)
AC_CHECK_SIZEOF(int, 4)
AC_CHECK_SIZEOF(long int, 4)
AC_CHECK_SIZEOF(long long int, 8)
AC_EXEEXT
AC_CONFIG_FILES([Makefile])
AC_OUTPUT
